package com.atguigu.shiro.serviceImpl;

import com.atguigu.shiro.dao.SysUserMapper;
import com.atguigu.shiro.entity.SysUser;
import com.atguigu.shiro.service.SysUserService;
import com.atguigu.shiro.utils.PageWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysUserImpl implements SysUserService {

    @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public PageWrapper<SysUser> list(String street,Integer pageNum,Integer pageSize) {
        PageWrapper<SysUser> pageWrapper = new PageWrapper<SysUser>();
        PageHelper.startPage(pageNum,pageSize);
        List<SysUser> sysUsers = sysUserMapper.listByStreet(street);
        PageInfo<SysUser> pageInfo = new PageInfo<>(sysUsers);
        pageWrapper.setPageInfo(pageInfo);
        return pageWrapper;
    }
}
